#include "Diamond.h"
#include "Vector3D.h"

e3d::Diamond::Diamond(	const e3d::Vector3Df& top, const e3d::Vector3Df& right, 
						const e3d::Vector3Df& down, const e3d::Vector3Df& left )
:	m_top( top ),
	m_right( right ),
	m_down( down ),
	m_left( left ),
	m_center( top.squareMiddle( right, down, left ) )
{}

e3d::Diamond::Diamond(	const e3d::Vector3Df& top, const e3d::Vector3Df& right, 
						const e3d::Vector3Df& down, const e3d::Vector3Df& left, 
						int pos_top, int pos_right, int pos_down, int pos_left )
:	m_top( top ),
	m_right( right ),
	m_down( down ),
	m_left( left ),
	m_center( top.squareMiddle( right, down, left ) ),
	m_pos_top( pos_top ),
	m_pos_right( pos_right ),
	m_pos_down( pos_down ),
	m_pos_left( pos_left )
{}


int e3d::Diamond::getPosCenter(void) const 
{ 
	 if( m_pos_left == -1 || m_pos_right == -1 ) 
		 return ( m_pos_top + m_pos_down ) / 2;
	 else 
		 return ( m_pos_left + m_pos_right ) / 2; 
}